package com.zzc.keleoj.judge.codesandbox;

import com.zzc.keleoj.judge.codesandbox.impl.ExampleCodeSandBox;
import com.zzc.keleoj.judge.codesandbox.impl.RemoteCodeSandBox;
import com.zzc.keleoj.judge.codesandbox.impl.ThirdPartyCodeSandBox;

/**
 * 根据不同的字符串返回对应的沙箱实例
 */
public class CodeSandBoxFactory {

    /**
     *
     * @param type 接收沙箱类型字符串
     * @return
     */
    public static CodeSandBox newInstance(String type) {
        switch (type) {
            case "example":
                return new ExampleCodeSandBox();
            case "remote":
                return new RemoteCodeSandBox();
            case "thirdParty":
                return new ThirdPartyCodeSandBox();
            default:
                return new ExampleCodeSandBox();
        }
    }
}
